* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

:root {
    --primary-color: #10a37f;
    --primary-hover: #0d8c6c;
    --sidebar-bg: #202123;
    --main-bg: #f5f5f5; /* 改为浅色背景，更像微信 */
    --message-user-bg: #95ec69; /* 用户消息气泡颜色 - 微信绿 */
    --message-assistant-bg: #ffffff; /* 助手消息气泡颜色 - 白色 */
    --text-primary: #000000; /* 改为深色文字 */
    --text-secondary: #7c7c7c;
    --text-muted: #9ca3af;
    --border-color: #e1e1e1; /* 改为浅色边框 */
    --input-bg: #ffffff;
    --hover-bg: #f0f0f0;
    --user-text-color: #000000;
    --assistant-text-color: #000000;
    --time-color: #8e8e93;
    --card-bg: #ffffff;
    --shadow: 0 10px 25px rgba(0, 0, 0, 0.05);
    --shadow-lg: 0 20px 40px rgba(0, 0, 0, 0.1);
    --success-color: #10a37f;
    --danger-color: #ef4444;
    --warning-color: #f59e0b;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    background-color: var(--main-bg);
    color: var(--text-primary);
    height: 100vh;
    overflow: hidden;
}

.app-container {
    display: flex;
    height: 100vh;
}

/* 侧边栏样式 */
.sidebar {
    width: 260px;
    background-color: var(--sidebar-bg);
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--border-color);
}

.sidebar-header {
    padding: 16px;
    border-bottom: 1px solid var(--border-color);
}

.new-chat-btn {
    width: 100%;
    padding: 12px;
    background-color: transparent;
    border: 1px solid var(--border-color);
    border-radius: 6px;
    color: var(--text-primary);
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    transition: background-color 0.2s;
}

.new-chat-btn:hover {
    background-color: var(--hover-bg);
}

.chat-history {
    flex: 1;
    padding: 8px;
    overflow-y: auto;
}

.history-item {
    padding: 12px;
    margin: 4px 0;
    border-radius: 6px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    transition: background-color 0.2s;
}

.history-item:hover {
    background-color: var(--hover-bg);
}

.history-item.active {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

.history-item i {
    width: 16px;
    text-align: center;
}

.sidebar-footer {
    padding: 16px;
    border-top: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.user-info {
    display: flex;
    align-items: center;
    gap: 8px;
}

.user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
}

.username {
    font-size: 14px;
    color: var(--text-primary);
}

/* 用户操作按钮组 */
.user-actions {
    display: flex;
    gap: 8px;
}

.user-action-btn {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 8px;
    border-radius: 4px;
    transition: background-color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.user-action-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
}

/* 主内容区域 */
.main-content {
    flex: 1;
    display: flex;
    flex-direction: column;
    background-color: var(--main-bg);
    position: relative;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 16px;
    padding-bottom: 180px; /* 保持足够的底部间距 */
    display: flex;
    flex-direction: column;
}

.welcome-message {
    text-align: center;
    max-width: 600px;
    margin: 0 auto;
    padding: 60px 20px;
    align-self: center;
}

.welcome-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background-color: var(--primary-color);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 32px;
    margin: 0 auto 24px;
}

.welcome-message h2 {
    font-size: 32px;
    margin-bottom: 16px;
    font-weight: 600;
}

.welcome-message p {
    font-size: 16px;
    color: var(--text-secondary);
    line-height: 1.5;
}

/* 微信风格消息样式 - 头像在两侧 */
.message {
    display: flex;
    margin-bottom: 20px;
    max-width: 100%;
    animation: fadeInUp 0.3s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 用户消息 - 右侧对齐，头像在右侧 */
.message.user-message {
    justify-content: flex-end;
}

/* 助手消息 - 左侧对齐，头像在左侧 */
.message.assistant-message {
    justify-content: flex-start;
}

.message-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-size: 16px;
    margin: 0 12px;
}

.user-avatar {
    background-color: #4CAF50; /* 微信绿色 */
    color: white;
    order: 2; /* 用户消息中头像在右侧 */
}

.assistant-avatar {
    background-color: #FF9800; /* 橙色 */
    color: white;
    order: 1; /* 助手消息中头像在左侧 */
}

.message-content-wrapper {
    display: flex;
    align-items: flex-start;
    max-width: 70%;
}

/* 用户消息内容区域 - 头像在右侧 */
.message.user-message .message-content-wrapper {
    flex-direction: row;
}

/* 助手消息内容区域 - 头像在左侧 */
.message.assistant-message .message-content-wrapper {
    flex-direction: row;
}

.message-content {
    background-color: var(--message-assistant-bg);
    border-radius: 18px;
    padding: 12px 16px;
    max-width: 100%;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
    position: relative;
}

/* 用户消息气泡样式 */
.message.user-message .message-content {
    background-color: var(--message-user-bg);
    border-top-right-radius: 4px; /* 用户消息气泡右上角小三角 */
    order: 1; /* 用户消息内容在左侧 */
}

/* 助手消息气泡样式 */
.message.assistant-message .message-content {
    background-color: var(--message-assistant-bg);
    border-top-left-radius: 4px; /* 助手消息气泡左上角小三角 */
    order: 2; /* 助手消息内容在右侧 */
}

.message-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px;
}

.message-sender {
    font-weight: 500;
    font-size: 14px;
    color: var(--text-secondary);
}

.message-time {
    font-size: 12px;
    color: var(--time-color);
    margin-left: 8px;
}

.message-text {
    line-height: 1.5;
    font-size: 16px;
    color: var(--text-primary);
    word-wrap: break-word;
}

.message.user-message .message-text {
    color: var(--user-text-color);
}

.message.assistant-message .message-text {
    color: var(--assistant-text-color);
}

.message-text code {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 2px 6px;
    border-radius: 4px;
    font-family: 'Monaco', 'Menlo', 'Ubuntu Mono', monospace;
    font-size: 14px;
    color: #e6e6e6;
}

.message-text strong {
    font-weight: 600;
}

.message-text em {
    font-style: italic;
}

.message-text pre {
    background-color: rgba(0, 0, 0, 0.05);
    padding: 12px;
    border-radius: 8px;
    overflow-x: auto;
    margin: 8px 0;
    border: 1px solid var(--border-color);
}

.message-text pre code {
    background: none;
    padding: 0;
    border-radius: 0;
    color: #333;
    font-size: 14px;
    line-height: 1.5;
}

/* 输入区域 */
.input-container {
    position: fixed;
    bottom: 0;
    left: 260px;
    right: 0;
    background: linear-gradient(180deg, transparent 0%, var(--main-bg) 50%, var(--main-bg) 100%);
    padding: 16px;
    padding-top: 80px;
    z-index: 100;
    border-top: 1px solid var(--border-color);
}

.input-wrapper {
    max-width: 768px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 10px;
}

.text-input-container {
    position: relative;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 24px;
    padding: 12px 60px 12px 16px;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.05);
}

.text-input-container:focus-within {
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(16, 163, 127, 0.1);
}

#messageInput {
    width: 100%;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 16px;
    line-height: 1.5;
    resize: none;
    max-height: 120px;
    outline: none;
    font-family: inherit;
}

#messageInput::placeholder {
    color: var(--text-muted);
}

.input-actions {
    position: absolute;
    right: 12px;
    bottom: 12px;
}

.send-btn {
    width: 32px;
    height: 32px;
    border: none;
    border-radius: 50%;
    background-color: var(--primary-color);
    color: white;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background-color 0.2s, transform 0.1s;
}

.send-btn:hover:not(:disabled) {
    background-color: var(--primary-hover);
    transform: scale(1.05);
}

.send-btn:active:not(:disabled) {
    transform: scale(0.95);
}

.send-btn:disabled {
    background-color: var(--border-color);
    cursor: not-allowed;
    opacity: 0.5;
}

.input-footer {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 12px;
}

.char-count {
    font-size: 12px;
    color: var(--text-muted);
}

.quick-actions {
    display: flex;
    gap: 8px;
}

.quick-action-btn {
    padding: 6px 12px;
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 16px;
    color: var(--text-secondary);
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 4px;
    transition: all 0.2s;
}

.quick-action-btn:hover {
    background-color: var(--hover-bg);
    color: var(--text-primary);
    border-color: var(--primary-color);
}

/* 打字指示器 */
.typing-indicator {
    position: fixed;
    bottom: 160px;
    left: 50%;
    transform: translateX(-50%);
    background-color: var(--input-bg);
    border: 1px solid var(--border-color);
    border-radius: 20px;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: 14px;
    color: var(--text-secondary);
    z-index: 1000;
    backdrop-filter: blur(10px);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.typing-dots {
    display: flex;
    gap: 4px;
}

.typing-dots span {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background-color: var(--text-muted);
    animation: typing 1.4s infinite ease-in-out;
}

.typing-dots span:nth-child(1) { animation-delay: -0.32s; }
.typing-dots span:nth-child(2) { animation-delay: -0.16s; }

@keyframes typing {
    0%, 80%, 100% { transform: scale(0.8); opacity: 0.5; }
    40% { transform: scale(1); opacity: 1; }
}

/* 模态框样式 */
.modal {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    display: flex;
    justify-content: center;
    align-items: center;
    z-index: 2000;
    animation: fadeIn 0.3s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

.modal-content {
    background-color: var(--card-bg);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    padding: 30px;
    width: 100%;
    max-width: 450px;
    margin: 20px;
    animation: slideIn 0.3s ease-out;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.password-modal {
    max-width: 420px;
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 24px;
    padding-bottom: 16px;
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    margin: 0;
    color: var(--text-primary);
    font-size: 20px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}

.modal-header h3 i {
    color: var(--primary-color);
}

.close-btn {
    background: none;
    border: none;
    font-size: 24px;
    color: var(--text-muted);
    cursor: pointer;
    padding: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color 0.2s;
}

.close-btn:hover {
    background-color: var(--hover-bg);
}

.modal-body .form-group {
    margin-bottom: 20px;
}

.modal-body label {
    display: block;
    margin-bottom: 8px;
    font-weight: 600;
    color: var(--text-primary);
    font-size: 14px;
    display: flex;
    align-items: center;
    gap: 8px;
}

.modal-body label i {
    color: var(--text-muted);
    width: 16px;
    text-align: center;
}

.modal-body input {
    width: 100%;
    padding: 14px 16px;
    border: 2px solid var(--border-color);
    border-radius: 10px;
    font-size: 16px;
    transition: all 0.3s ease;
    background-color: #f8fafc;
}

.modal-body input:focus {
    outline: none;
    border-color: var(--primary-color);
    background-color: white;
    box-shadow: 0 0 0 3px rgba(16, 163, 127, 0.1);
}

.password-hint {
    font-size: 12px;
    color: var(--text-muted);
    margin-top: 6px;
    padding-left: 24px;
}

/* 表单按钮组 */
.form-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.cancel-btn, .confirm-btn {
    flex: 1;
    padding: 14px;
    border: none;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.cancel-btn {
    background-color: #f8fafc;
    color: var(--text-secondary);
    border: 2px solid var(--border-color);
}

.cancel-btn:hover {
    background-color: #f1f5f9;
    border-color: var(--text-muted);
}

.confirm-btn {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--primary-hover) 100%);
    color: white;
    box-shadow: 0 4px 12px rgba(16, 163, 127, 0.2);
}

.confirm-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(16, 163, 127, 0.3);
}

.confirm-btn:active {
    transform: translateY(0);
}

/* 滚动条样式 */
.chat-messages::-webkit-scrollbar,
.chat-history::-webkit-scrollbar {
    width: 6px;
}

.chat-messages::-webkit-scrollbar-track,
.chat-history::-webkit-scrollbar-track {
    background: transparent;
}

.chat-messages::-webkit-scrollbar-thumb,
.chat-history::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 3px;
}

.chat-messages::-webkit-scrollbar-thumb:hover,
.chat-history::-webkit-scrollbar-thumb:hover {
    background: var(--text-muted);
}

/* 响应式设计 */
@media (max-width: 768px) {
    .sidebar {
        display: none;
    }

    .input-container {
        left: 0;
        padding-top: 60px;
    }

    .app-container {
        flex-direction: column;
    }

    .message {
        padding: 0 10px;
    }

    .message-content-wrapper {
        max-width: 85%;
    }

    .chat-messages {
        padding: 10px;
        padding-bottom: 160px;
    }

    .input-container {
        padding: 12px;
        padding-top: 40px;
    }

    .typing-indicator {
        bottom: 140px;
    }

    .modal-content {
        margin: 10px;
        padding: 20px;
    }

    .form-actions {
        flex-direction: column;
    }
}

/* 代码高亮样式 */
.language-python {
    color: #3572A5;
}

.language-javascript {
    color: #f1e05a;
}

.language-java {
    color: #b07219;
}

.language-html {
    color: #e34c26;
}

.language-css {
    color: #563d7c;
}